from flask_sqlalchemy import SQLAlchemy
from datetime import datetime

db = SQLAlchemy()


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, doc='ID')
    name = db.Column(db.String(15), doc='用户昵称')
    signature = db.Column(db.String(20), doc='个性签名')
    photo = db.Column(db.String(256), doc='用户头像')


class Circle4Friends(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, doc='ID')
    content = db.Column(db.String(64), doc='朋友圈内容')
    picture = db.Column(db.String(20480), doc='图片')
    add_time = db.Column(db.DateTime, default=datetime.now, doc='发布时间')
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))


class Friend(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, doc='ID')
    user_id = db.Column(db.Integer, doc='用户ID')
    friend_id = db.Column(db.Integer, doc='好友ID')
    status = db.Column(db.Integer, default=0, doc="朋友圈是否可见(0,可见;1,不可见)")
